'''
Created on Dec 6, 2009

@author: Elena
'''

import wx
import Geometry

class GeometryGUI(wx.Frame):
	'''
	classdocs
	'''


	def __init__(self, title):
		'''
		Constructor
		'''		
		''' GUI '''
		wx.Frame.__init__(self, None, title=title, size=(350,200))
		self.Bind(wx.EVT_CLOSE, self.onClose)
		self.panel = wx.Panel(self, size=(350, 200))
		self.panel.Bind(wx.EVT_PAINT, self.onPaint)
		self.Fit()
		''' geometry '''
		self.geometry = None
			
	def onClose(self, event):
		#print 'closing!'
	
		dlg = wx.MessageDialog(self,
							"Wanna quit?",
							"Confirm exit", wx.OK|wx.CANCEL|wx.ICON_QUESTION)
		result = dlg.ShowModal()
		dlg.Destroy()
		if result == wx.ID_OK:
			self.Destroy()
			
	def onPaint(self, event):
		#establish the painting surface
		dc = wx.PaintDC(self.panel)
		dc.SetPen(wx.Pen('blue', 4))
		# draw a Line
		dc.DrawPolygon(self.geometry.getPoints())
		#dc.DrawRectangleList(((10,10,10,10),(20,20,10,10)), None, None)
	

app = wx.App(redirect=True)
gui = GeometryGUI("Hello World")
gui.geometry = Geometry.Geometry()
gui.geometry.readDefaultShape1()
gui.Center()
gui.Show()
app.MainLoop()